home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / ec_plus / ec-plus.lha / generics / WListString_.h < prev   
C/C++ Source or Header  |  1989-10-10  |  1KB  |  62 lines

  1.  
  2. typedef String* String_;
  3.  
  4. //#include "containers/WList.h"
  5.  
  6.  
  7. extern int        stepString_;
  8.  
  9. extern void     initializeWListString_(int);
  10.  
  11.  
  12. struct WListString_ : WList 
  13. {
  14.                             /* A generic parameterized container 
  15.                             with string-like capabilities, implemented as a 
  16.                             dynamic array of elements of type String_.
  17.                             Type String_ must fit in a word. */
  18.  
  19. friend class WList_iteratorString_;
  20.  
  21. public:
  22.  
  23.     WListString_() : WList() {}
  24.     void     append(String_ w) 
  25.                 {WList::append((word)w, stepString_);}
  26.     void     insert(int i, String_ w)
  27.                 {WList::insert(i, (word)w, stepString_);}
  28.     void     add(String_ w)
  29.                 {WList::add((word)w, stepString_);}
  30.     int     where_is(String_ w)
  31.                 {return WList::where_is((word)w);}
  32.     void     remove(int i)
  33.                 {WList::remove(i, stepString_);}
  34.     int     length()
  35.                 {return WList::length();}
  36.     String_&     operator[](int i)
  37.                 {return (String_&) WList::operator[](i);}
  38. };
  39.  
  40.  
  41.  
  42.  
  43. struct WList_iteratorString_ : WList_iterator
  44. {
  45.  
  46. public:
  47.  
  48.     WList_iteratorString_(WListString_* h, int i) : 
  49.                 WList_iterator(h, i) {}
  50.  
  51.     int     first(String_& elem)
  52.                 {return WList_iterator::first((word&) elem);}
  53.     int     next(String_& elem)
  54.                 {return WList_iterator::next((word&) elem);}
  55.     int     last(String_& elem)
  56.                 {return WList_iterator::last((word&) elem);}
  57.     int     prev(String_& elem)
  58.                 {return WList_iterator::prev((word&) elem);}
  59.     int     index()
  60.                 {return WList_iterator::index();}
  61. };
  62.